216
a:4:{s:8:"template";a:2:{s:53:"E:/xampp/htdocs/rbac/Admin/Tpl/Authority/addUser.html";b:1;s:29:"../Common/head_authority.html";b:1;}s:9:"timestamp";i:1522139257;s:7:"expires";i:1522139260;s:13:"cache_serials";a:0:{}}<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>权限</title>
    <link href="http://localhost/rbac/Admin/Tpl/Public/css/bootstrap.min.css" type="text/css" rel="stylesheet"/>
    <link href="http://localhost/rbac/Admin/Tpl/Public/css/admin-authority.css" type="text/css" rel="stylesheet"/>
    <script src="http://localhost/rbac/Admin/Tpl/Public/js/jquery-3.2.1.min.js"></script>
    <script src="http://localhost/rbac/Admin/Tpl/Public/js/bootstrap.min.js"></script>
</head><body>
<div class="container-fluid">
    <div class="row" style="margin: 20px 0px;">
        <b>添加用户</b>
        <a href="javascript:history.back();" style="float: right;">返回</a>
    </div>
    <form action="#" method="post">
        <div class="row" style="height: 35px;line-height: 35px;margin-top: 15px;">
            <div class="col-sm-2 col-md-2 col-lg-2" style="text-align: right">
                <b>昵称</b>
            </div>
            <div class="col-sm-5 col-md-5 col-lg-5">
                <input type="text" name="username" id="username" class="form-control"/>
            </div>
            <div class="col-sm-5 col-md-5 col-lg-5" style="display: none" id="username_w">
                <p style="color: red;font-size: 12px;">
                    <span class="glyphicon glyphicon-exclamation-sign"></span>
                    &nbsp;昵称已存在，请重新设置！
                </p>
            </div>
            <div class="col-sm-5 col-md-5 col-lg-5" style="display: none" id="username_r">
                <p style="color: lawngreen;font-size: 12px;">
                    <span class="glyphicon glyphicon-ok"></span>
                    &nbsp;昵称设置正确！
                </p>
            </div>
        </div>
        <div class="row" style="height: 35px;line-height: 35px;margin-top: 15px;">
            <div class="col-sm-2 col-md-2 col-lg-2" style="text-align: right">
                <b>邮箱</b>
            </div>
            <div class="col-sm-5 col-md-5 col-lg-5">
                <input type="text" name="email" id="email" class="form-control"/>
            </div>
            <div class="col-sm-5 col-md-5 col-lg-5" style="display: none" id="email_w">
                <p style="color: red;font-size: 12px;">
                    <span class="glyphicon glyphicon-exclamation-sign"></span>
                    &nbsp;请输入正确的邮箱！
                </p>
            </div>
            <div class="col-sm-5 col-md-5 col-lg-5" style="display: none" id="email_r">
                <p style="color: lawngreen;font-size: 12px;">
                    <span class="glyphicon glyphicon-ok"></span>
                    &nbsp;邮箱格式正确！
                </p>
            </div>
        </div>
        <div class="row" style="height: 35px;line-height: 35px;margin-top: 15px;">
            <div class="col-sm-2 col-md-2 col-lg-2" style="text-align: right">
                <b>密码</b>
            </div>
            <div class="col-sm-5 col-md-5 col-lg-5">
                <input type="password" id="password" name="password" class="form-control"/>
            </div>
            <div class="col-sm-5 col-md-5 col-lg-5" style="display: none" id="password_w">
                <p style="color: red;font-size: 12px;">
                    <span class="glyphicon glyphicon-exclamation-sign"></span>
                    &nbsp;密码长度太短，请重新输入！
                </p>
            </div>
            <div class="col-sm-5 col-md-5 col-lg-5" style="display: none" id="password_r">
                <p style="color: lawngreen;font-size: 12px;">
                    <span class="glyphicon glyphicon-ok"></span>
                    &nbsp;密码长度合理！
                </p>
            </div>
        </div>
        <div class="row" style="height: 35px;line-height: 35px;margin-top: 15px;">
            <div class="col-sm-2 col-md-2 col-lg-2" style="text-align: right">
                <b>确认密码</b>
            </div>
            <div class="col-sm-5 col-md-5 col-lg-5">
                <input type="password" id="pwd" class="form-control"/>
            </div>
            <div class="col-sm-5 col-md-5 col-lg-5" style="display: none" id="pwd_w">
                <p style="color: red;font-size: 12px;">
                    <span class="glyphicon glyphicon-exclamation-sign"></span>
                    &nbsp;两次输入密码不一致，请重新输入！
                </p>
            </div>
            <div class="col-sm-5 col-md-5 col-lg-5" style="display: none" id="pwd_r">
                <p style="color: lawngreen;font-size: 12px;">
                    <span class="glyphicon glyphicon-ok"></span>
                    &nbsp;两次密码输入正确！
                </p>
            </div>
        </div>
        <div class="row" style="height: 35px;line-height: 35px;margin-top: 15px;">
            <div class="col-sm-2 col-md-2 col-lg-2" style="text-align: right">
                <b>所属角色</b>
            </div>
            <div class="col-sm-5 col-md-5 col-lg-5">
                                <span style="margin-right: 15px">
                   <input type="checkbox" name="rid[]" value="1" style="display: inline-block;vertical-align: middle;margin-bottom: 5px;"/>超级管理员
                </span><br/>
                                <span style="margin-right: 15px">
                   <input type="checkbox" name="rid[]" value="2" style="display: inline-block;vertical-align: middle;margin-bottom: 5px;"/>管理员
                </span><br/>
                            </div>
        </div>
        <div class="row" style="height: 35px;line-height: 35px;margin-top: 15px;">
            <div class="col-sm-offset-2 col-md-offset-2 col-lg-offset-2 col-sm-5 col-md-5 col-lg-5">
                <button type="submit" id="sub" class="btn btn-primary pull-right">确定</button>
            </div>
        </div>
    </form>
</body>

<script>
    $(document).ready(function(){
        $("#username").blur(function(){
            var username = $("#username").val();
            $.ajax({
                type:"post",
                url:"./admin.php?c=Authority&m=checkUserName",
                data:{username:username},
                dataType:"json",
                success:function(data){
                    if(data){
                        $("#username_r").css('display','block');
                        $("#username_w").css('display','none');
                        $("#sub").removeAttr("disabled");
                    }else{
                        $("#username_w").css('display','block');
                        $("#username_r").css('display','none');
                        $("#sub").attr("disabled","disabled");
                    }
                }
            })
        })
        $("#email").blur(function(){
            var isEmail = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
            var email = $("#email").val();
            if(isEmail.test(email)){
                $("#email_r").css('display','block');
                $("#email_w").css('display','none');
                $("#sub").removeAttr("disabled");
            }else{
                $("#email_w").css('display','block');
                $("#email_r").css('display','none');
                $("#sub").attr("disabled","disabled");
            }
        })
        $("#pwd").blur(function(){
            var password = $("#password").val();
            var pwd = $("#pwd").val();
            if(password == pwd){
                $("#pwd_r").css('display','block');
                $("#pwd_w").css('display','none');
                $("#sub").removeAttr("disabled");
            }else{
                $("#pwd_w").css('display','block');
                $("#pwd_r").css('display','none');
                $("#sub").attr("disabled","disabled");
            }
        })
        $("#password").blur(function(){
            var password = $("#password").val();
            if(password.length < 6){
                $("#password_w").css('display','block');
                $("#password_r").css('display','none');
                $("#sub").attr("disabled","disabled");
            }else{
                $("#password_r").css('display','block');
                $("#password_w").css('display','none');
                $("#sub").removeAttr("disabled");
            }
        })
    })
</script>

</html>